package cn.com.demo.config;

import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.userdetails.UserDetails;

import java.util.Collection;
import java.util.List;

public class MyUser implements UserDetails {
    /**用户名*/
    private String userName;
    /**密码*/
    private String userPassword;
    //权限
    private List<GrantedAuthority> permissionValueList;

    public MyUser(String userName, String userPassword,List<GrantedAuthority> authorities) {
        this.userName = userName;
        this.userPassword = userPassword;
        this.permissionValueList = authorities;
    }

    @Override
    public Collection<? extends GrantedAuthority> getAuthorities() {
        return permissionValueList;
    }

    @Override
    public String getPassword() {
        return this.userPassword;
    }

    @Override
    public String getUsername() {
        return this.userName;
    }

    @Override
    public boolean isAccountNonExpired() {
        return true;
    }

    @Override
    public boolean isAccountNonLocked() {
        return true;
    }

    @Override
    public boolean isCredentialsNonExpired() {
        return true;
    }

    @Override
    public boolean isEnabled() {
        return true;
    }
}
